package com.digitalchina.lxnsy.viewholder;

import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.FarmMoneyVO;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：郑皓
 * 创建时间：2017-06-17 14:38:34
 * 修改备注：
 * ================================================
 */

public class MyFarmMoneyListHolder extends BaseViewHolder<FarmMoneyVO> {

    private TextView tvTitle;
    private TextView tvTime;
    private TextView tvNumber;


    public MyFarmMoneyListHolder(ViewGroup parent) {
        super(parent, R.layout.item_my_farm_money);
        tvTitle = $(R.id.item_my_farm_money_tv_title);
        tvTime = $(R.id.item_my_farm_money_tv_time);
        tvNumber = $(R.id.item_my_farm_money_tv_number);
    }

    @Override
    public void setData(FarmMoneyVO data) {
        super.setData(data);

        tvTitle.setText(data.getRemark());
        tvTime.setText(data.getCreateTime());
        if (data.getPointStatus().equals("0")) {
            tvNumber.setText(String.format("+%s", data.getPointValue()));
            tvNumber.setTextColor(getContext().getResources().getColor(R.color.app_color));
        } else {
            tvNumber.setText(String.format("-%s", data.getPointValue()));
            tvNumber.setTextColor(getContext().getResources().getColor(R.color.colorFontRed));
        }
    }

}
